]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
screenshot: Only select area on button release after a button down
authorSebastian Keller <skeller@gnome.org>
Wed, 28 Apr 2021 05:13:35 +0000 (07:13 +0200)
committerMarge Bot <marge-bot@gnome.org>
Wed, 28 Apr 2021 11:40:19 +0000 (11:40 +0000)
On Wayland it is possible to trigger area selection with a button
already being down. SelectArea would then react to the subsequent button
release without ever having seen a corresponding button down first,
leaving the start coordinates of the selection rectangle uninitialized.

Related: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2761
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1825>

js/ui/screenshot.js

index 583f8b7c54caa7d7ec5826ddc21924af9dc99993..e736c3f6c744d2d2a5ce423b9e637284623bd736 100644 (file)
@@ -393,6 +393,9 @@ class SelectArea extends St.Widget {
     }
 
     vfunc_button_release_event() {
+        if (this._startX === -1 || this._startY === -1)
+            return Clutter.EVENT_PROPAGATE;
+
         this._result = this._getGeometry();
         this.ease({
             opacity: 0,